package Year22_Month03.day15;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        System.out.println(fun(s1,s2));
    }

    public static int fun(String s1,String s2){
        if(s1 == null || s2 == null){
            return 0;
        }
        String max;
        String min;
        if(s1.length() > s2.length()){
            max = s1;
            min = s2;
        }else{
            max = s2;
            min = s1;
        }
        for (int i = 0; i < min.length(); i++) {
            for(int begin = 0,end = min.length()-i;end <= min.length();begin++,end++){
                String s = min.substring(begin,end);
                if(max.contains(s)){
                    return s.length();
                }
            }
        }
        return 0;
    }
}
